<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>

    <meta name="description" content="描述">
    <meta name="keywords" content="关键词">
    <link rel="icon" href="">
    <link rel="shortcut icon" href="">
    <link rel="stylesheet" href="/web/public/css/public.css">
  <link rel="stylesheet" href="/web/public/css/header.css">
  <link rel="stylesheet" href="/web/public/css/footer.css">
  <link rel="stylesheet" href="/web/public/css/my-comment.css">
  <link rel="stylesheet" href="/web/public/css/aside.css">
    <!--    <link rel="stylesheet" href="//at.alicdn.com/t/font_2052942_xzk2q3ix0w.css">-->
    <title>我的评论</title>
    <script src="/web/lib/jquery-1.12.4.min.js"></script>
    <script src="/web/public/public.js"></script>
    <script src="/web/lib/jquery.pagination.js"></script>
</head>
<body>
<div class="container">
    <!--这里引入header-->
    <include file="/web/html/header/header.htm" page-type="1"></include>
    <div id="main">
        <div class="aside-wrap">
            <include file="/web/html/fragment/personal-center/aside.htm"></include>
        </div>
        <div class="list-wrap">
            <div class="tab-list">
                <div class="tab-item">
                    我的评论
                </div>
            </div>
            <ul class="content-list">
                <li>
                    <div class="top">
                        <i class="iconfont icon-shijian1"></i>
                        <span>2020-08-28</span>
                    </div>
                    <div class="comment">
                        由清科集团、投资界主办、华发集团联合主办，珠海市人民政府作为特别支持单位的第二十届中国股权投资年度论坛于2020年10月12-15日在珠海国际会展中心成功举办。本届论坛汇集百位投资巨匠，共赴行业二十年之约。
                    </div>
                    <div class="article-title">
                        <a href="javascript:" target="_blank">原文：文章的标题文章的标题文章的标题文章的标题文章的标题文章的标题文章的标题文章题文章题文章题文章</a>
                    </div>
                </li>
            </ul>
            <div class="list-pagination"></div>
        </div>
    </div>
    <include file="/web/html/footer/footer.htm"></include>
</div>
<script>
    $(function () {
        $('#personal-center-aside .aside-list .comment').addClass('active');

        function getCommentList(pageNum, resetPage) {
            var pageSize = 10;
            $.ajax({
                url: ports.getMyComments,
                data: {
                    pageNum: pageNum,
                    pageSize: pageSize
                },
                success: function (res) {
                    console.log('获取我的评论', res);

                    if (res.status == 200) {
                        if (res.data.list && res.data.list.length) {
                            var html = '';
                            $.each(res.data.list, function (i, item) {
                                html += '<li>\n' +
                                    '        <div class="top">\n' +
                                    '            <i class="iconfont icon-shijian1"></i>\n' +
                                    '            <span>' + item.updateTime + '</span>\n' +
                                    '        </div>\n' +
                                    '        <div class="comment">\n' + item.comments +
                                    '        </div>\n' +
                                    '        <div class="article-title">\n' +
                                    '            <a href=' + (item.article && item.article.articleUrl ? item.article.articleUrl : 'javascript:') + ' target=' + (item.article && item.article.articleUrl ? '_blank' : '_self') + '>' + (item.article && item.article.articleTitle ? item.article.articleTitle : '原文不存在或已失效') + '</a>\n' +
                                    '        </div>\n' +
                                    '    </li>';
                            });
                            $('ul.content-list').html(html);
                            if (resetPage) {
                                $('.list-pagination').pagination({
                                    prevContent: '< 上一页',
                                    nextContent: '下一页 >',
                                    totalData: res.data.total,
                                    showData: pageSize,
                                    coping: true,
                                    callback: function (api) {
                                        console.log(api.getCurrent());
                                        var current = api.getCurrent();
                                        document.body.scrollTop = 0;
                                        document.documentElement.scrollTop = 0;
                                        getCommentList(current, false);
                                    }
                                });
                            }
                        }

                    }
                }
            })
        }

        getCommentList(1, true)
    })
</script>
</body>
</html>